<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Version Checking</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="kvaser.gif"/></td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('page_user_guide_version.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">Version Checking </div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p>CANlib versions are denoted by two numbers, the "major version" and the "minor
  version". Usually the version is presented as these two numbers separated by a period. For example, CANlib 3.6 has major version 3 and minor version 6.</p>
<p>You may want to make your application determine which version of CANlib is installed on the computer it is running on. There are several ways of obtaining version information.</p>
<p>First, it is necessary to observe that CANlib consists of several files, each one with a version number. Your application must check all these version numbers to be certain that all files are of the correct version.</p>
<p>As a rule, files in CANlib has two version numbers:</p>
<ol type="1">
<li>The <b>file version</b> number. This consists of a major version number, a minor version number, and a build number. The file version number uniquely identifies a particular file but doesn't say much about which version of CANlib is installed on the computer.</li>
<li>The file <b>product number</b>. This number uniquely identifies the version of CANlib that the file belongs to.</li>
</ol>
<p>Use <a class="el" href="group__can__general.html#ga0803bc56e8695150563a48df2c14db5f">canGetVersionEx()</a> to get the version of the CANlib API DLL. This function allows you to get both the file and the product version number of the API DLL.</p>
<p><b>Example</b>. Checking version with <a class="el" href="group__can__general.html#ga0803bc56e8695150563a48df2c14db5f">canGetVersionEx()</a> </p><div class="fragment"><div class="line"><span class="keyword">union </span>{</div><div class="line">    uint16_t C;</div><div class="line">    <span class="keyword">struct </span>{</div><div class="line">        <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> Minor;</div><div class="line">        <span class="keywordtype">unsigned</span> <span class="keywordtype">char</span> Major;</div><div class="line">    };</div><div class="line">}Version;</div><div class="line"></div><div class="line"><span class="comment">// Using the argument canVERSION_CANLIB32_PRODVER will return the product version.</span></div><div class="line">Version.C = <a class="code" href="group__can__general.html#ga0803bc56e8695150563a48df2c14db5f">canGetVersionEx</a>(<a class="code" href="canlib_8h.html#a8d72028015110e384b36efab7f847542">canVERSION_CANLIB32_PRODVER</a>);</div><div class="line">printf(<span class="stringliteral">&quot;%s %d.%d\n&quot;</span>, <span class="stringliteral">&quot;Found CANLib version&quot;</span>, Version.Major, Version.Minor);</div></div><!-- fragment --><p>Use <a class="el" href="group__can__general.html#gab9552d1a588b0dbc144b097acba017b2">canGetChannelData()</a> to get the version numbers of the second-level DLL and the driver file. This information may vary from channel to channel.</p>
<p>You can also use <a class="el" href="group__can__general.html#gab9552d1a588b0dbc144b097acba017b2">canGetChannelData()</a> to obtain information about the firmware revision for a particular channel.</p>
<p>When testing the version numbers, it is good practice to allow a later version to be installed. That is, don't check for equality with a specific version number. Instead, check that the major version number of the installed version is greater than or equal to the desired version, and if it is equal, check that the minor version number of the installed version is greater than or equal to the desired version. </p>
</div></div><!-- contents -->
</div><!-- doc-content -->
<!-- HTML footer for doxygen 1.8.13-->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="page_canlib.html">CAN bus API (CANlib)</a></li>
    <li class="footer"> (canlib 5.38) Tue Feb 15 2022</li>
  </ul>
</div>
</body>
</html>
